package com.smart.resource;


import org.junit.Test;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;

import static org.junit.Assert.*;

/**
 * @author chenxingyu
 * @date 2019/8/21 11:02
 */
public class PatternResolverTest {
    @Test
    public void getResource() throws Throwable{
        PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();

        //加载所有类包com.smart(及子孙包)下以.xml为后缀的资源
        Resource[] resources = resolver.getResources("classpath*:conf/*.xml");
        assertNotNull(resources);
        for (Resource resource:resources){
            System.out.println(resource.getDescription());
        }
    }
}
